package org.zappee.dannyt.cairngorm.model
{
	import com.adobe.cairngorm.model.IModelLocator;
	
	import mx.collections.ArrayCollection;
	import mx.collections.IList;
	
	import org.zappee.dannyt.cairngorm.business.Bug;

    [Bindable]
    public class ModelLocator implements com.adobe.cairngorm.model.IModelLocator
    {
        private static var modelLocator : org.zappee.dannyt.cairngorm.model.ModelLocator;
        
        public static function getInstance() : org.zappee.dannyt.cairngorm.model.ModelLocator 
        {
            if ( modelLocator == null )
                modelLocator = new org.zappee.dannyt.cairngorm.model.ModelLocator();
                
            return modelLocator;
       }
       
       public function ModelLocator() 
       {
           if ( org.zappee.dannyt.cairngorm.model.ModelLocator.modelLocator != null )
                throw new Error( "Only one ModelLocator instance should be instantiated" );    
       }
        
        // main collection of bugs
        public var bugs : IList;
        public var lastBugId:int = 4;
        
        public var manageBug:Bug;
        
        // list of priorities
        public var priorityList:IList = new ArrayCollection([Bug.PRIORITY_LOW, Bug.PRIORITY_MEDIUM, Bug.PRIORITY_HIGH]);
        
        // list of assignees
        public var developerList:IList = new ArrayCollection(["peter@moov2.com", "dan@moov2.com", "andrea@moov2.com"]);
        
        // application views
        public var viewState : Number = ModelLocator.VIEWING_BUG_LIST_SCREEN;
        public static const VIEWING_BUG_LIST_SCREEN : Number = 0;
        public static const VIEWING_MANAGE_BUG_SCREEN : Number = 1;
    }
}